package coroutines.coroutine.cancel

import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking

class CancelTest {
}

fun main() {
    runBlocking {
        val job = launch {
            repeat(1000) {
                println("job: I'm slepping $it ...")
                delay(500L)
            }
        }

        delay(5000)

        println("main: I'm tried of waiting!")

        job.cancel()
        job.join()

        println("main: Now I can quit.")
    }
}